// 角色管理相关的API请求函数

import request from '@/utils/request'

const prefix = '/dev-api'

// 获取角色分页列表(带搜索)  GET /admin/acl/role/{page}/{limit}
export const reqGetPageList = (page, limit, searchObj) => request({ url: prefix + `/admin/acl/role/${page}/${limit}`, method: 'get', params: searchObj })

// 获取某个角色  GET /admin/acl/role/get/{id}   传id
export const reqGetRole = (id) => request({ url: prefix + `/admin/acl/role/get/${id}`, method: 'get' })

// 保存一个新角色  POST /admin/acl/role/save 传roleName
export const reqSave = (role) => request({ url: prefix + '/admin/acl/role/save', method: 'post', data: role })

// 更新一个角色  PUT /admin/acl/role/update
export const reqUpdateById = (role) => request({ url: prefix + '/admin/acl/role/update', method: 'put', data: role })

// 获取一个角色的所有权限列表  GET /admin/acl/permission/toAssign/{roleId} 传roleId
// export const reqGetToAssign = (roleId) => request({ url: `/admin/acl/permission/toAssign/${roleId}`, method: 'get' })

// 删除某个角色  DELETE /admin/acl/role/remove/{id}
export const reqRemove = (id) => request({ url: prefix + `/admin/acl/role/remove/${id}`, method: 'delete' })

// 批量删除多个角色  DELETE /admin/acl/role/batchRemove
export const reqBatchRemoves = (ids) => request({ url: prefix + '/admin/acl/role/batchRemove', method: 'delete', data: ids })
